package jdk10.newAPI;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

/**
 * Reader:transferTo方法 : 从该读取器读取所有字符，并按照读取顺序将这些字符写入给定的写入器
 */
public class TransferTo {

	public static void main(String[] args) throws Exception{
		var reader = new BufferedReader(new InputStreamReader(new FileInputStream("d:/aa.txt"), "gbk"));
		var p = new PrintWriter(new File("d:/cc.txt"));
		reader.transferTo(p);
		p.flush();
		p.close();
		reader.close();
	}
}
